/*
 * Copyright 2010 - 2011, The PLDesktop Development Team
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */
#ifndef PLILISTITERATOR_H
#define PLILISTITERATOR_H

#include <tools/PLListNode.h>

namespace PLSDK {
    
    /**
     * Interface for the iterator for lists.
     */
    template<typename T>
    class PLIListIterator {
    public:
        /**
         * Constructor.
         */
        inline PLIListIterator() {}
        /**
         * Add a new object to the current position.
         *
         * @param object Object to add.
         * @param current The current node of the list.
         */
        virtual void add(T object, PLListNode<T> *current) = 0;
        /**
         * Delete a object.
         *
         * @param current The object to remove.
         * @return The new current node.
         */
        virtual PLListNode<T> *remove(PLListNode<T> *current) = 0;
        /**
         * Set a object to the current object.
         *
         * @param object The data to set.
         * @param current The current node.
         */
        virtual void set(T object, PLListNode<T> *current) = 0;
        /**
         * Have the current node a next object.
         *
         * @param current The current node.
         * @return true If the node have a next node.
         */
        virtual bool hasNext(PLListNode<T> *current) = 0;
        /**
         * Have the current node a previous node.
         *
         * @param current The current node.
         * @return true If the node have a previous node.
         */
        virtual bool hasPrevious(PLListNode<T> *current) = 0;
        /**
         * Get the next object.
         *
         * @param current The current node.
         * @return The object and go to the next object.
         */
        virtual T next(PLListNode<T> *current) = 0;
        /**
         * Get the previous object.
         *
         * @param current The current node.
         * @return The object and go to the previous object.
         */
        virtual T previous(PLListNode<T> *current) = 0;
    private:
        PLDISABLE_COPY(PLIListIterator<T>)
    };

}

#endif
